The present invention relates to a buffer memory managing method in, for example, a printing apparatus and, more particularly, to a method of managing a print buffer for storing data transmitted from a host computer, and the like, and a printing apparatus adapting the method.
A printing apparatus which can be controlled by a plurality of different printer control languages is known. In such a printing apparatus, an emulation mode corresponding to the printer control language to be used is informed by a host computer, and data necessary for the emulation is loaded down from the host computer. Thereafter, the printing apparatus receives print data written in the printer control language and performs a printing operation in accordance with the emulation mode by using the down-loaded data for the emulation. For example, there are cases where a plurality of application softwares correspond to respective printing apparatuses. In such cases, the printing apparatus actually connected to a host computer emulates other printing apparatuses used by respective applications. Therefore, the data which is necessary for the emulation has to be loaded down to the actually connected printing apparatus. In order to register the data which is necessary for the emulation, e.g., symbols and special fonts, in the printing apparatus from an application software, a memory area, called fixed data buffer, is reserved in the printing apparatus. The size of the fixed data buffer depends upon emulation modes.
Such a printing apparatus which emulates two or more printing apparatuses and automatically switches emulation modes for the emulations must reserve the maximum fixed data buffer size required by the emulation modes in a memory of the printing apparatus when the apparatus is powered on.
However, when the fixed data buffer size is set to the maximum size required by the emulation modes, more than necessary memory area may be reserved as the fixed data buffer in an emulation mode which does not require a large fixed data buffer size, which greatly wastes a memory area.
Further, the larger the size of a print data buffer provided in a printing apparatus for receiving data transmitted from a host computer, the larger the amount of data which can be transmitted in one operation from a host computer. Accordingly, a large print data buffer in the printing apparatus is preferred since a host computer can be released early. However, a large print data buffer requires increase in the capacity of memory, which is a disadvantage in terms of cost.
The present invention has been made in consideration of the above situation, and has as its object to eliminate a wasted area in a limited memory area in a printing apparatus and effectively use the memory by reassigning the wasted area as a print data buffer, thereby providing a buffer managing method capable of increasing the print data buffer size in the memory of the printing apparatus without increasing a manufacturing cost and providing a printing apparatus adapting the method.
The foregoing object is attained by providing a buffer managing method for managing a data storage area, assigned in a memory of a predetermined size, and a ring buffer which is sequentially addressable to the data storage area, the method comprising: a calculation step of calculating a size which can be reduced from the data storage area; a determination step of determining no received data is stored at the end of the ring buffer; and an expansion step of expanding the ring buffer by the size which is calculated at the calculation step by moving a border between the ring buffer and the data storage area if it is determined at the determination step that no received data is stored at the end of the ring buffer.
Further, the foregoing object is also attained by providing a printing apparatus capable of executing an emulation mode designated by a host device out of a plurality of emulation modes, the apparatus comprising: a memory having a predetermined size of storage area; assigning means for assigning an area of the memory corresponding to a maximum fixed data buffer size required by the plurality of emulation modes as a fixed data buffer, and assigning the rest of an area of the memory as a ring buffer which stores data received from the host device; receiving means which receives data from the host device; determination means for determining an emulation mode in accordance with data received by the receiving means; calculation means for calculating a difference between the fixed data buffer size which is required by the determined emulation mode and the maximum fixed data buffer size assigned by the assigning means; judging means for judging whether or not no received data is stored at the end of the ring buffer; and an expansion means for expanding the ring buffer by the size calculated by the calculation means by moving a border between the ring buffer and the fixed data buffer if it is determined that no received data is stored at the end of the ring buffer by the judging means.
Furthermore, the foregoing object is also attained by providing a computer program produce comprising a computer usable medium having computer readable program code means embodied in the medium for managing a data storage area, assigned in a memory of a predetermined size, and a ring buffer which is sequentially addressable to the data storage area, the product including: first computer readable program code means for calculating a size which can be reduced from the data storage area; second computer readable program code means for determining no received data is stored at the end of the ring buffer; and third computer readable program code means for expanding the ring buffer by the size which is calculated at the calculation step by moving a border between the ring buffer and the data storage area if it is determined at the determination step that no received data is stored at the end of the ring buffer.
With the aforesaid configurations, when a plurality of different emulation modes are switched automatically, the fixed data buffer size necessary in each emulation mode can be individually set, thereby effectively utilizing a memory area. Further, since the remaining memory area is used as a print data buffer, it is possible to increase the print data buffer size without increasing the capacity of the memory.
Other features and advantages of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same or similar parts throughout the figures thereof.